<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>群体感知写作</title>
<link href="/pad/resources/css/bootstrap.min.css" rel="stylesheet">
<link href="/pad/resources/css/style.css" rel="stylesheet">
</head>
<body>
	<nav class="navbar navbar-blue navbar-fixed-top" role="navigation">
		<div class="container bs-docs-container">
			<div class="navbar-header">
				<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-6">
					<span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span>
				</button>
				<h1>Pad</h1>
			</div>
			<ul class="nav navbar-nav">
				<li class="active"><a href="#">课程列表</a></li>
			</ul>
			<ul class="nav navbar-nav navbar-right">
				<li class="dropdown"><a id="user" href="#" class="dropdown-toggle" data-toggle="dropdown">用户 <span class="caret"></span></a>
					<ul class="dropdown-menu" role="menu">
						<li><a href="/pad/logout">退出登录</a></li>
					</ul></li>
			</ul>
		</div>
	</nav>
	<div class="container bs-docs-container">
		<div>
			<iframe id="editpad" src='#' width="100%" height="300" frameborder="no" border="0"></iframe>
		</div>
	</div>
	<script src="/pad/resources/js/jquery.min.js"></script>
	<script src="/pad/resources/js/jquery.form.min.js"></script>
	<script src="/pad/resources/js/bootstrap.min.js"></script>
	<script>
		function getQueryString(name) {
			var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
			var r = window.location.search.substr(1).match(reg);
			if (r != null)
				return unescape(r[2]);
			return null;
		}
		$.ajax({
			url : '/pad/getSessionUser',
			success : function(user) {
				$.ajax({
					url : '/pad/assignment/getAssignmentPadCurrentId?assignmentId='
							+ getQueryString('assignmentId'),
					success : function(data) {
						$("#editpad").attr("height", $(window).height() - 95);
						$("#editpad").attr(
								"src",
								"http://localhost:8081/p/" + data.id
										+ "?userName=" + user.realname);
					}
				});
				$("#user").html(user.realname);
			}
		});
	</script>
</body>
</html>
